package com.ycd;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


// springboot启动类注解
@SpringBootApplication
// 开启Eureka服务注解-可加可不加导入了客户端依赖，默认Eureka客户端
@EnableEurekaClient
// 开启熔断功能
@EnableCircuitBreaker
public class OrderApp {

    public static void main(String[] args) {

        // new SpringApplicationBuilder(Application.class).web(true).run(args);
        SpringApplication.run(OrderApp.class,args);
    }
    @Bean // 让当前方法返回的对象称为一个bean对象
    @LoadBalanced // 让RestTemplate拥有负载均衡能力
    public RestTemplate restTemplate(){

        return new RestTemplate();
    }


}